<?php
/*
 *   This file is part of verbum.
 *
 *   verbum is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   verbum is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with verbum.  If not, see <http://www.gnu.org/licenses/>.
 *   
 *   Copyright (c) 2008 Sergio Gabriel Teves <gabriel.sgt at gmail.com>
 * */
 

function check($id) {
	if (!defined(AVOID_SESSION)) {
		if (USE_SESSION_CACHE===true and isset($_SESSION[$id])) return true;
	}
	return false;
}

function retrieve($id) {
	if (!defined(AVOID_SESSION)) {
		if (isset($_SESSION[$id])) { 
			return unserialize($_SESSION[$id]);
		}
	}
	return false;
}

function cache($id,$obj) {
	if (!defined(AVOID_SESSION)) {	
		$_SESSION[$id]=serialize($obj);
	}
}

function clearCache($id) {
	if (!defined(AVOID_SESSION)) {
		unset($_SESSION[$id]);
	}
}

?>
